<template>
	<u-empty v-if="deviceEventsWithIsRead.length==0" mode="message"></u-empty>
	<uni-list v-else :border="true">
		<uni-list-chat v-for="item in deviceEventsWithIsRead" :key="item.id" :title="item.设备类型" :avatar="thumbnail"
			:note="item.处理状态" :time="item.报警发生时间" badge-positon="left" :badge-text="item.isRead ? '' : 'dot'" clickable
			showArrow @click="handle_alarm_click(item)">
		</uni-list-chat>
	</uni-list>
</template>

<script>
	import {
		mapActions,
		mapGetters
	} from "vuex";
	export default {
		name: "WoDeXiaoXi",
		data() {
			return {
				thumbnail: "/static/images/WoDeXiaoXi/XiaoXiTiShi.png",
			};
		},
		onShow() {
			console.log("deviceEventsWithIsRead", this.deviceEventsWithIsRead)
		},
		mounted() {},
		computed: {
			...mapGetters(["noReadCount", "deviceEventsWithIsRead"]),
		},
		methods: {
			...mapActions(["fetchDeviceEvents", "addReadEvents"]),
			//点击后弹窗提示，并将信息已读存入缓存（addReadEvents(id)）
			handle_alarm_click(item) {
				this.addReadEvents(item.id);
				this.$tab.navigateTo("/pages/WoDeXiaoXi/detail?id=" + item.id);
			},
		},
	};
</script>

<style>
</style>